<%-- 
    Document   : editItem.jsp
    Created on : Apr 30, 2011, 8:49:25 PM
    Author     : christophe
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  "http://www.w3.org/TR/html4/loose.dtd">


<%@include file="/WEB-INF/jspf/tagImports.jspf" %>

<html:html lang="true">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Edit/Create Item</title>

  </head>

  <tags:menu />
  <div id ="content">
    <tags:body>
      <html:errors  />

      <h2>Add Item</h2>
      <c:if test="${requestScope.inError}">
        <div id="errorMessage" style="color: red;">Please fill in any missing fields</div>
      </c:if>


      <c:url var="saveUrl" value="/user/saveItem.do"/>
      <form action="${saveUrl}" method="post">
        <c:if test="${not empty ItemForm.itemID}">
          <input type="hidden" name="itemID" value="${ItemForm.itemID}"
          </c:if>

          <tags:textInput formFieldName="name" labelName="Name" textValue="${ItemForm.name}" />
          <tags:textInput formFieldName="description" labelName="Description" textValue="${ItemForm.description}" />
          <tags:textInput formFieldName="salePrice" labelName="Sale Price" textValue="${ItemForm.salePrice}" />

          <!-- Handle the categories -->

          <div class="input">
          <label for="name">Item Categories</label>

          <html:select name="ItemForm" property="itemCategoryID">
            <c:forEach var="category" items="${ItemForm.availableCategories}">
              <html:option value="${category.itemCategoryID}" >
                <c:out value="${category.name}" />
              </html:option>
            </c:forEach>
          </html:select>

        </div>




        <input type="submit" value="Add Item" />

        <!-- TODO: Add a cancel button... and figure out where it goes -->
      </form>
    </tags:body>
  </div>
  <div id = "footer">
    <span>
      &nbsp;All rights reserved Garage Sale 2011 | Legal | Privacy Policy
    </span>
    <br><br>
    <img alt="" src="../../images/b1.gif">
    <img alt="" src="../../images/b2.gif" style="margin:0px 5px 0px 5px">
    <img alt="" src="../../images/b3.gif">
  </div>

</html:html>


